<template>
    <div class="content">
        <button class="btn btn-danger btn-lg btn-top" @click="$emit('close')">&times;</button>
        <table class="table table-bordered table-hover text-nowrap">
            <thead>
                <tr>
                    <th class="cell" v-for="(val,i) in title" :key="i">{{val}}</th>
                </tr>
            </thead>
            <tbody>
                <tr v-for="(row,i) in source" :key="i">
                    <td class="cell" v-for="(val,i) in row" :key="i">
                        {{val}}
                        <span v-if="val==''">-</span>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script>
export default {
    name: "tableView",
    props: {
        title: {
            type: Array,
            required: true
        },
        source: {
            type: Array,
            required: true
        }
    }
};
</script>

<style scoped>
.btn-top {
    position: fixed;
    z-index: 2001;
    right: 1em;
    bottom: 1em;
    box-shadow: 0 0.1em 0.3em rgba(0, 0, 0, 0.6);
    border-radius: 100%;
    font-size: 2em;
    padding: 0;
    width: 1.5em;
    height: 1.5em;
}
.content {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    bottom: 0;
    right: 0;
    overflow: auto;
    background: #fff;
    padding: 3em 4em 4em 3em;
}
.cell {
    font-size: 0.85em;
    padding: 0.25em 1em;
}
</style>